package com.syp.envops.domain;

public enum ConfigTypeEnum {

	SHELL("sh", ".sh", "shell脚本文件"), 
	XML("xml", ".xml", "XML文件"), 
	HTML("html", ".html", "HTML文件"), 
	HTM("htm", ".htm", "HTM文件"), 
	JAVA("java", ".java", "java源码文件"),
	JSP("java", ".jsp", "jsp文件"),
	JAVASCRIPT("javascript", ".js", "js脚本文件"),
	PROPERTIES("generic", ".properties", "JAVA配置文件"), 
	TXT("generic", ".txt", "文本文件"),
	DEFAULT("generic", "*", "位置文件按文本处理");

	private String code;
	private String ext;
	private String desc;

	private ConfigTypeEnum(String code, String ext, String desc) {
		this.code = code;
		this.ext = ext;
		this.desc = desc;
	}

	public String getCode() {
		return code;
	}

	public String getExt() {
		return ext;
	}

	public String getDesc() {
		return desc;
	}
	
	public static ConfigTypeEnum getEnum(String ext){
		for(ConfigTypeEnum ct : ConfigTypeEnum.values()){
			if(ct.getExt().equalsIgnoreCase(ext)){
				return ct;
			}
		}
		return DEFAULT;		
	}

}
